<div id="sidebar">
<div id="">
    <h2><?php __('Actions'); ?></h2>
       <div class="actions">
	<ul>
           	<li><?php echo $this->Html->link(__('Upcoming Events', true), array('action' => 'index', 'upcoming')); ?> </li>
		<li><?php echo $this->Html->link(__('Past Events', true), array('action' => 'index', 'past')); ?> </li>

	</ul>
</div>
</div>
</div>

<div class="events form">
<?php
    echo($javascript->link("preview_image.js"));
    echo $this->Form->create('Event', array('action'=>'edit','enctype' => 'multipart/form-data'));
?>
	<fieldset>
 		<legend><?php __('Edit Event'); ?></legend>
	<?php
		
		echo $this->Form->input('event_name',array('label'=>'Event name'));
		echo $this->Form->input('description',array('label'=>'Description'));

                echo $this->Form->input('image',array('type'=>'file','id'=>'picField','onchange'=>'preview(this)','label'=>'Event image'));
                echo '<center>';

                if(file_exists('img/event/'.$event['Event']['id'].'.jpg')){
                    echo $this->Html->image('event/'.$event['Event']['id'].'.jpg', array('alt' => 'Preview','id'=>'previewField'));
                }else{
                    echo $this->Html->image('default_event.jpg', array('alt' => 'Preview','id'=>'previewField'));
                }

                echo '<br/><br/>';
                echo '</center>';

                echo $this->Form->input('capacity',array('label'=>'Capacity'));

		echo $this->Form->input('event_start',array('label'=>'Event start date'));
		echo $this->Form->input('event_end',array('label'=>'Event end date'));
		$current_time =   date('Y-m-d H:i:s', time());
                echo $this->Form->hidden('create_ts', array('value' => $current_time));

		echo $this->Form->input('rsvp_start',array('label'=>'Rsvp start date'));
		echo $this->Form->input('rsvp_end',array('label'=>'Rsvp end date'));


                $options=array('invite'=>'Invite','public'=>'Public');
                $attributes=array('legend'=>'Event type');
                echo $this->Form->radio('event_type',$options,$attributes);


		echo $this->Form->input('venue_addr1',array('label'=>'Adress'));
		echo $this->Form->input('venue_addr2',array('label'=>'Adress 2'));
		echo $this->Form->input('venue_city',array('label'=>'City'));
		echo $this->Form->input('venue_state',array('label'=>'State'));
		echo $this->Form->input('venue_postal',array('label'=>'Postal'));
	?>
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
